package dnbW.dbW;

import java.util.ArrayList;

/**
 * Encapsulates a document in a data source
 * @author truongbaquan
 */
public class Document {
    private DataSource dataSource;

    public DataSource getDataSource() {
        return dataSource;
    }

    private int docId;

    public int getDocId() {
        return docId;
    }

    // <editor-fold defaultstate="collapsed" desc="Values">
    private ArrayList<Long> rValues = new ArrayList<Long>();

    public long getrValue(int level) {
        return rValues.get(level-1);
    }

    private ArrayList<Long> ancestorValues = new ArrayList<Long>();

    public long getAncestorValue(int level) {
        return ancestorValues.get(level-1);
    }

    public void setValues(int level, long rValue, long ancestorValue) {
        this.rValues.ensureCapacity(level+1);
        this.rValues.add(level-1, rValue);
        this.ancestorValues.ensureCapacity(level+1);
        this.ancestorValues.add(level-1, ancestorValue);
    }
    // </editor-fold>

    public Document(DataSource dataSource, int docId) {
        this.dataSource = dataSource;
        this.docId = docId;
    }
}
